TAG=main.t

#CC = icc -std=c++11
#CC = icpc -std=c++11 -qopenmp
#CC = g++ -std=c++11 #-fopenmp -lpthread
CC= mpic++ -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1 -acc -Minfo=accel -ta=tesla:managed -std=c++11 -mp -mavx
#CC= mpic++ -D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1  -Minfo=accel –ta=tesla:managed -std=c++11 -mp -mavx
# -acc : OpenAcc;  -mp : OpenMp ; -lm : standard Math libaray
lib_path= -L$(HOME)/usr/lib
lib_math= -L/usr/include
INC= -I$(HOME)/usr/include

GSL_LIBS= $(lib_path) -lgsl $(lib_path) -lgslcblas
Boost_LIBS= $(lib_path) -lboost_serialization $(lib_path) -lboost_system $(lib_path) -lboost_mpi $(lib_path) -lboost_filesystem $(lib_path) -lboost_date_time
Math_LIBS= $(lib_math) -lm

NV_LIBS= -L/usr/local/cuda/lib64 -ldl
NV_INC=-I/usr/local/cuda/include

DIR_OBJ = ./obj


#OBJ=$(OBJ_Sep)$(OBJ_Com)

OBJ= \
./obj/main_part.o \
./obj/main_control_part.o \
./obj/antisym_coeff.o \
./obj/trans_coeff.o \
./obj/const_nucl.o \
./obj/coupling_coeff.o \
./obj/basis_state.o \
./obj/com_sparse_row.o \
./obj/get_input_file.o \
./obj/check_file.o \
./obj/Wigner_signs.o \
# ./obj/acc_utils.o \
# ./obj/gsl_fac.cpp \
# ./obj/wavefun_coeff.o \
# ./obj/cont_term.o \
# ./obj/ope_term.o \
# ./obj/tpe_term.o \
# ./obj/package.o \

#checkVsTok.o checkTwoPi.o
#cg_coeff.o  rbhf_solver.o

#OBJ = main.o coupling_coeff.o basis_state.o antisym_coeff.o wavefun_coeff.o tpe_term.o

CFLAGS = -O3 -Wl,--rpath=$(HOME)/usr/lib
#CFLAGS= -O3 -Wl,--rpath=/Users/zhuo/usr/lib
#CFLAGS= -O3 -Wl,--rpath=/opt/usr/lib
#VPATH=../DF_src/DF_Mpi_Sep ../DF_src/DF_Common

vpath %.cpp ./ ../SRC/DF_Mpi_Sep ../SRC/DF_Common
vpath %.h ../SRC/DF_Mpi_Sep ../SRC/DF_Common
vpath %.o ./obj

$(TAG):$(OBJ)
	$(CC) $(CFLAGS) -o $(TAG) $(OBJ) $(LIB) $(GSL_LIBS) $(Boost_LIBS) $(NV_LIBS) $(Math_LIBS)

$(DIR_OBJ)/%.o:%.cpp
	$(CC) $(INC) $(NV_INC) -c $< -o $@



.PHONY : clean
clean:
	rm main.t $(OBJ) $(DIR_OBJ)/*
	#rm *.o main.t *~ *.gch  *.dat ./serial_dat/*.dat #./data/*.dat
